package com.weixin.paleituo.adapter;

/**
 * Author yichao
 * Time  2017/12/1 0:38
 * Dest  商品分类内容
 */

import android.content.Context;
import android.widget.TextView;

import com.weixin.paleituo.R;
import com.weixin.paleituo.base.BaseRecycleAdapter;
import com.weixin.paleituo.bean.ChildrenBeanX;
import com.weixin.paleituo.help.RecycleViewHolder;
import com.weixin.paleituo.view.MyGridView;

import java.util.List;

public class ClassifyContentRecyclerViewAdapter extends BaseRecycleAdapter<ChildrenBeanX> {


private MyGridView mMMyGridView;
private TextView mMTextViewTitle;
private int mtype;
private int RECOMMONDTYPE=1;//推荐
private  int BRANDTYPE=2;//品牌

    public ClassifyContentRecyclerViewAdapter(Context context, List<ChildrenBeanX> childrenBeanXList) {
        super(context,childrenBeanXList, R.layout.classify_content_item_layout);
    }

    /**
     *
     * @param type  1推荐  2品牌
     */
    public  void setType(int type){
        mtype=type;
    }




    @Override
    protected void setData(RecycleViewHolder holder, ChildrenBeanX childrenBeanX, int position) {
        mMMyGridView = holder.getItemView(R.id.gridView_sale_status_menu);
        mMTextViewTitle = holder.getItemView(R.id.tv_title_sale_statues_content_item_layout);
        mMTextViewTitle.setText(childrenBeanX.getName());
        if (mtype==RECOMMONDTYPE){
            //推荐
            mMMyGridView.setNumColumns(2);

            ClassifyRecommadGoodsGridViewAdapter classifyRecommadGoodsGridViewAdapter=new ClassifyRecommadGoodsGridViewAdapter(mContext,childrenBeanX.getChildren());
            mMMyGridView.setAdapter(classifyRecommadGoodsGridViewAdapter);

        }else if (mtype==BRANDTYPE){
            //品牌
            mMMyGridView.setNumColumns(3);
            ClassifyGridViewAdapter classifyGridViewAdapter=new ClassifyGridViewAdapter(mContext,childrenBeanX.getChildren());
            mMMyGridView.setAdapter(classifyGridViewAdapter);

        }


    }

}
